﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gao.Poker.Domain
{
    public class BonusCalculation
    {
        private Bouns _bouns;
        private Competition _competition;

        public BonusCalculation(Bouns bouns,Competition competition)
        {
            _bouns = bouns;
            _competition = competition;
        }

        /// <summary>
        /// 名次
        /// </summary>
        public int Rank { get { return _bouns.Rank; } }

        public decimal Bouns
        {
            get
            {
                decimal bonus;

                if (_competition.DownsidePoints < _competition.TotalPoints)
                {
                    bonus = (decimal)(_competition.TotalPoints * _bouns.Scale / 100 * (1 - _competition.ManCastRatio / (float)100));
                }
                else
                {
                    bonus = (decimal)(_competition.DownsideBonus * _bouns.Scale / 100 * (1 - _competition.ManCastRatio / (float)100));
                }

                return bonus;
            }
        }
    }
}
